﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class UserRolesControllerBase : Controller{
	public UserRolesControllerBase()
		: base()
	{
	}
	private static UserRolesDAO _Service; 
	public static UserRolesDAO Service{
		get{
			if(_Service==null)
				_Service = new UserRolesDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public UserRolesEntity MapDataRowToObject(DataRow row){
		UserRolesEntity o = new UserRolesEntity();
		 if(!row.IsNull("RoleId"))
			o.RoleId=(Int32)(row["RoleId"]);
		 if(!row.IsNull("UserId"))
			o.UserId=(Int32)(row["UserId"]);
		 if(!row.IsNull("UserRoleId"))
		    o.UserRoleId=(Int32)(row["UserRoleId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(UserRolesEntity o,DataRow row){
		row["RoleId"]=o.RoleId;
		row["UserId"]=o.UserId;
		row["UserRoleId"]=o.UserRoleId;
    }
}
}
